Skip to content

Conversation

@BillLeoutsakosvl346
Copy link

Summary

Add TikTok integration with OAuth authentication and Display API support. Implements 3 tools (Get User Info, List Videos, Query Videos) and a block UI with operation dropdown and conditional fields.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • bun run type-check - passes
  • bun run build (sim package) - succeeds
  • bun run test - all 3696 tests pass
  • bun run lint - passes
  • Manual testing: Block appears in UI, operation dropdown works, conditional fields show/hide correctly

Note: Full API testing requires TikTok Developer approval (Display API access takes several days).

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

TikTok Block in UI

Changes

New files:

  • tools/tiktok/ - Types and 3 tool implementations
  • blocks/blocks/tiktok.ts - Block UI configuration

Modified files:

  • lib/oauth/types.ts - Added 'tiktok' provider type
  • lib/oauth/oauth.ts - Added TikTok OAuth configuration
  • lib/auth/auth.ts - Added TikTok auth provider
  • lib/core/config/env.ts - Added TIKTOK_CLIENT_ID/SECRET env vars
  • components/icons.tsx - Added TikTokIcon
  • tools/registry.ts - Registered TikTok tools
  • blocks/registry.ts - Registered TikTok block

@vercel
Copy link

vercel bot commented Feb 1, 2026

@BillLeoutsakosvl346 is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

@BillLeoutsakosvl346 BillLeoutsakosvl346 changed the base branch from main to staging February 1, 2026 22:33
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 1, 2026

Greptile Overview

Greptile Summary

This PR adds TikTok integration with OAuth authentication and Display API support, implementing 3 tools (Get User Info, List Videos, Query Videos) and a block UI with operation dropdown and conditional fields.

Key changes:

  • Added TikTok OAuth provider with proper scopes (user.info.basic, user.info.profile, user.info.stats, video.list)
  • Implemented 3 API tools with proper error handling and type definitions
  • Created block configuration with conditional field rendering based on operation
  • Registered tools and blocks in respective registries
  • Added environment variable configuration for client credentials

Code quality:

  • Follows existing patterns for OAuth integrations (similar to Spotify, WordPress)
  • Type definitions are well-structured with proper nullable fields
  • Error handling is consistent across all tools
  • Uses absolute imports throughout

Confidence Score: 4.5/5

  • Safe to merge with minor style improvements recommended
  • Implementation follows established patterns, has proper error handling, and includes comprehensive type definitions. Only minor style issues with any types in video mapping functions.
  • No files require special attention - minor style improvements suggested in list_videos.ts and query_videos.ts

Important Files Changed

Filename Overview
apps/sim/tools/tiktok/get_user.ts Tool implementation for fetching TikTok user info with proper OAuth, type definitions, and error handling
apps/sim/tools/tiktok/list_videos.ts Tool for listing user videos with pagination support, uses any type in video mapping
apps/sim/tools/tiktok/query_videos.ts Tool for querying specific videos by IDs, uses any type in video mapping
apps/sim/blocks/blocks/tiktok.ts Block configuration with conditional fields, operation dropdown, and proper OAuth integration
apps/sim/lib/auth/auth.ts Added TikTok OAuth provider with proper scopes, endpoints, and user info fetching
apps/sim/lib/oauth/oauth.ts Added TikTok OAuth configuration with refresh token rotation support

Sequence Diagram

sequenceDiagram
    participant User
    participant SimApp as Sim Application
    participant Auth as Auth Provider (auth.ts)
    participant TikTok as TikTok OAuth
    participant TikTokAPI as TikTok Display API
    participant Block as TikTok Block
    participant Tool as TikTok Tool

    User->>SimApp: Configure TikTok Block
    SimApp->>Block: Load TikTok Block Config
    Block->>User: Show OAuth credential field
    
    User->>SimApp: Click "Connect TikTok Account"
    SimApp->>Auth: Request TikTok OAuth
    Auth->>TikTok: Redirect to authorization URL
    Note over Auth,TikTok: Required scopes: user info,<br/>profile, stats, video list
    
    TikTok->>User: Show authorization screen
    User->>TikTok: Grant permissions
    TikTok->>Auth: Send approval
    Auth->>TikTok: Get credentials
    TikTok->>Auth: Return credentials
    Auth->>TikTokAPI: Fetch user info
    TikTokAPI->>Auth: Return user profile
    Auth->>SimApp: Save credential
    
    User->>Block: Select operation & configure inputs
    User->>SimApp: Execute workflow
    SimApp->>Block: Get tool & params from operation
    Block->>Tool: Call selected tool (get_user/list_videos/query_videos)
    Tool->>TikTokAPI: API request
    TikTokAPI->>Tool: Return data
    Tool->>Block: Transform & return response
    Block->>SimApp: Output results
    SimApp->>User: Display workflow results
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

}
}

const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: any) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use explicit type instead of any for video parameter

Suggested change
const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: any) => ({
const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: unknown) => ({

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/tiktok/list_videos.ts
Line: 66:66

Comment:
use explicit type instead of `any` for video parameter

```suggestion
    const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: unknown) => ({
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

}
}

const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: any) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use explicit type instead of any for video parameter

Suggested change
const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: any) => ({
const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: unknown) => ({

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/tools/tiktok/query_videos.ts
Line: 63:63

Comment:
use explicit type instead of `any` for video parameter

```suggestion
      const videos: TikTokVideo[] = (data.data?.videos ?? []).map((video: unknown) => ({
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@icecrasher321
Copy link
Collaborator

@BillLeoutsakosvl346 Could you take a look at the bugbot comments?

Also, is it possible to see if Tiktok has any content publishing APIs rather than just fetching details? That'd be super useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants